<?php 
date_default_timezone_set('America/Bogota');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <?php $this->load->view('head'); ?>
            <link type="text/css" href="<?php echo base_url() . "css/redmond/jquery-ui-1.8.14.custom.css"; ?>" rel="stylesheet" />
            <script src="<?php echo base_url() . "js/jquery-ui-1.8.14.custom.min.js"; ?>" type="text/javascript"></script>
            <script src="<?php echo base_url() . "js/jquery.ui.datepicker-es.js" ?>" type="text/javascript"></script>
            <link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_url() . "css/ui.jqgrid.css" ?>" />
            <script src="<?php echo base_url() . "js/i18n/grid.locale-es.js" ?>" type="text/javascript"></script>
            <script src="<?php echo base_url() . "js/jquery.jqGrid.min.js" ?>"  type="text/javascript"></script>
            <style type="text/css">
                .claseno{color:red}
                .ui-jqgrid tr.jqgrow td {
                    white-space: normal !important;
                    height:auto;
                    vertical-align:text-top;
                    padding-top:2px;
                }
            </style>
            <title></title>
            <script type="text/javascript">
                $(document).ready(function(){
                    $("#fecIni").datepicker({dateFormat:"yy-mm-dd",changeMonth: true,changeYear: true, yearRange: '1941:<?php echo date('Y'); ?>' });
                    $("#fecFin").datepicker({dateFormat:"yy-mm-dd",changeMonth: true,changeYear: true, yearRange: '1941:<?php echo date('Y'); ?>' });
                    jQuery("#list").jqGrid({
                        url: '<?php echo site_url("grilla/sigueSolicitud/historico"); ?>',
                        datatype: 'json',
                        mtype: 'POST',
                        colNames:['Seguimientos','Consultar','FechaSolicitud','Tipo','Nombre','Descripción','SalBase','SalTope'],
                        colModel :[
                            {name:'seguir',index:'seguir', width:109,align:"center",sortabel:false,search:false},
                            {name:'consultar',index:'consultar', width:100,align:"center",sortabel:false,search:false},
                            {name:'empresaContacto',index:'sol.solServyAseFechaCreo', width:135,align:"center"},
                            {name:'empresaTelefono1',index:'sol.solServyAseTipo', width:80,hidden:true},
                            {name:'empresaRazon',index:'sol.solServyAseNombre', width:220},
                            {name:'empresaNit',index:'sol.solServyAseDescripcion', width:220},
                            {name:'empresaContacto',index:'sol.solServyAseSalBase', width:110,formatter:"currency",align:"right"},
                            {name:'solServyAseSalTope',index:'sol.solServyAseSalTope', width:110,formatter:"currency",align:"right"}
                        ],
                        postData: {
                            fecIni: function() { return $("#fecIni").val(); },
                            fecFin: function() { return $("#fecFin").val(); }
                        },
                        loadComplete: function(){
                            var ids = jQuery("#list").getDataIDs();
                            for(var i=0;i<ids.length;i++){
                                var cl = ids[i];
                                var ret = jQuery("#list").jqGrid('getRowData',cl);
                                var se = "<input type='button' onclick=\"fnVer('" + ret.consultar + "','" + ret.seguir + "');\" tittle='De click para ver mas información de quien solicita el servicio o asesoría' value='" + ret.seguir + "'/>";
                                jQuery("#list").setRowData(cl,{consultar:se});
                                se = "<input type='button' onclick=\"fnSigue('" + cl + "');\" tittle='De click para consultar los seguimientos a la solicitud de Servicio o Asesoria' value='Ver'/>";
                                jQuery("#list").setRowData(cl,{seguir:se});
                            }
                        },
                        pager: jQuery('#pager'),
                        rowNum:50,
                        rowList:[10,20,30,50],
                        sortname: 'sol.solServyAseFechaCreo',
                        sortorder: "asc",
                        viewrecords: true,
                        caption: 'SOLICITUDES Y SERVICIOS',
                        height:260
                    });
                    //Barra de navegación
                    jQuery("#list").jqGrid('navGrid','#pager',{del:false,add:false,edit:false,view:true},{},{},{},{multipleSearch:true},{closeOnEscape:true});
<?php $this->load->view('enReady'); ?>
                        }); //fin $(document).ready(function(){
                        function fnVer(id,opc){
                            if(opc == "Empresa") window.open("<?php echo site_url("registrarInst/verEmpresa/") . "/"; ?>" + id + "/conID", "Seguimiento", "width=1300,height=500,scrollbars=YES");
                            else window.open("<?php echo site_url("empresa/consulta/4") . "/"; ?>" + id + "/conID", "Persona", "width=1300,height=500,scrollbars=YES");
                        }
                        function fnSigue(contra){
                            window.open("<?php echo site_url("registrarInst/sigue/") . "/"; ?>" + contra + "/consulta", "Seguimiento", "width=1300,height=500,scrollbars=YES");
                        }
            </script>
    </head>
    <body>
        <div class="divTitulo">REPORTE HISTORICO DE TODOS LOS SERVICIOS Y/O ASESORÍAS ATENDIDOS</div>
        <br/>
        <table align="center">
            <tr>
                <td><label for="fecIni">Fecha Inicial</label></td>
                <td><input type="text" id="fecIni" name="fecIni" size="9" /> </td>
                <td><label for="fecFin">Fecha Final</label></td>
                <td><input type="text" id="fecFin" name="fecFin" size="9" /> </td>
                <td><input type="button" value="Consultar" onclick="$('#list').trigger('reloadGrid');"/></td>
            </tr>
        </table><br/>
        <div id="pager" class="scroll" style="text-align:center;"></div>
        <table id="list" class="scroll" style="font-size: 14px"></table>
    </body>
</html>
